﻿package{
	
	
	import flash.display.Sprite;
	import flash.display.MovieClip;
	import flash.text.TextField;
	import flash.events.MouseEvent;
	import flash.events.Event;
	
	public class Menu_Records extends MovieClip{
		
		
		
		public function Menu_Records(){
			
			
			addEventListener(Event.ADDED_TO_STAGE, Init);
			
		}
		
		private function Init(e:Event) {
			removeEventListener(Event.ADDED_TO_STAGE, Init);
			
			Close.addEventListener(MouseEvent.CLICK, onClickClose);
			LeaderBoard.addEventListener(MouseEvent.CLICK, onClickLeaderBoard);
			
			_C0.text = "x" + Clickr.cubeArray[0].toString();
			_C1.text = "x" + Clickr.cubeArray[1].toString();
			_C2.text = "x" + Clickr.cubeArray[2].toString();
			_C3.text = "x" + Clickr.cubeArray[3].toString();
			_C4.text = "x" + Clickr.cubeArray[4].toString();
			
			var cubePoint:Number = Clickr.cubeArray[0] * 1000 + Clickr.cubeArray[1] * 5000 + Clickr.cubeArray[2] * 10000 + Clickr.cubeArray[3] * 20000 + Clickr.cubeArray[4] * 60000;
			
			_TXT1.text = Clickr.makeCurrency(Clickr.bestScore);
			_TXT2.text = Clickr.makeCurrency(cubePoint);
			
		}
		private function onClickClose(e:MouseEvent) {
			trace(this, ": onClickClose");
			dispatchEvent(new NavigationEvent(NavigationEvent.CLOSE, "records", this));
			
		}
		
		private function onClickLeaderBoard(e:MouseEvent):void {
			trace(this, ": onClickLeaderBoard");
			
			dispatchEvent(new NavigationEvent(NavigationEvent.SHOW_LEADERBOARD, "records", this));
			
			
		}
		
	}
	
	
}